package _abstract.factory.store;

import _abstract.factory.NYPizzaIngredientFactory;
import _abstract.factory.PizzaIngredientFactory;
import _abstract.factory.pizza.CheesePizza;
import _abstract.factory.pizza.Pizza;
import _abstract.factory.pizza.VeggiePizza;
import simple.factory.method.SimplePizzaFactory;

public class NYPizzaStore extends PizzaStore {
    public NYPizzaStore(SimplePizzaFactory pizzaFactory) {
        super(pizzaFactory);
    }

    @Override
    Pizza createPizza(String type) {
        Pizza pizza;
        PizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory();

        switch (type) {
            case "cheese":
                pizza = new CheesePizza(ingredientFactory);
                pizza.setName("纽约风格芝士比萨");
                break;
            case "veggie":
                pizza = new VeggiePizza(ingredientFactory);
                pizza.setName("纽约风格蔬菜比萨");
            default:
                throw new IllegalStateException("Unexpected value: " + type);
        }
        return pizza;
    }
}
